<template>
  <div class="section-wrap" style="height:100%;padding-top: 40px">
    <div class="headerBox">
      <div class="header">
        <x-icon type="ios-arrow-left" size="" class="icon-white" @click="goBack"></x-icon>
        安全稽查列表
      </div>
    </div>
    <!-- <img src="@/assets/imgs/add_pro_icon.png" class="add_btn"
         @click="$router.push({path:'./brankAbarbeitung',query:{recordId:$route.query.recordId,name:'下发安全稽查违章记分通知书'}})"> -->
    <div class="add_btn"
        v-if="$route.query.leaderId==$store.state.userid"
        @click="$router.push({path:'./brankAbarbeitung',query:{recordId:$route.query.recordId,name:$route.query.name,departId:$route.query.departId,leaderId:$route.query.leaderId}})"></div>
    <vue-better-scroll
      class="wrapper"
      ref="scrollqq"
      :scrollbar="scrollbarObj"
      :pullDownRefresh="pullDownRefreshObj"
      :pullUpLoad="pullUpLoadObj"
      :startY='parseInt(startY)'
      @pullingUp="onPullingUp"
    >
      <!-- 头部 -->

      <div class="form-section">
        <div class="project_div">
          <ul class="project_list">
            <li v-for="(items,index) in resultlist" :key="index" @click="$router.push({path:'./scoreNoticeDetails',query:{id:items.id}})">
              <h4>{{items.receivedeparname}}</h4>
              <div>
                <p><span style="margin-right: 10px">{{items.weiztype}}</span></p>
                <p><span>{{items.weizDate.substring(0,10)}}</span></p>
              </div>
              <i>{{items.weizRemarkCount}}</i>
              <x-icon type="ios-arrow-right" size="22" class="icon-right"
                      ></x-icon>
            </li>
          </ul>
        </div>
      </div>


    </vue-better-scroll>
  </div>
  <!--classValue 显示隐藏   data树结构  nodeClicK节点点击返回值  name显示的字段  people -->
  </div>
</template>
<script>
  import ztree from "@commonComponents/tree"
  import formatDate from "../../utils/formatDate"
  import VueBetterScroll from "vue2-better-scroll"
  import {XHeader, Tabbar, TabbarItem, Group, Cell, TransferDom, Popup} from 'vux'

  export default {
    data() {
      return {
        /*下拉刷新*/
        resultlist: [],
        scrollbarObj: {fade: true},
        pullDownRefreshObj: false,
        pullUpLoadObj: {
          threshold: 0,
          txt: {
            more: "加载更多",
            noMore: "没有更多数据了"
          }
        },
        startY: 0,
        scrollToX: 0,
        scrollToY: 0,
        scrollToTime: 700,
        isDisabled: true, // 是否禁止输入

        detailData: {
          DeptName: ''
        },
        params: {
          recordId: this.$route.query.recordId,
          weiztype: this.$route.query.name,
          // status: 0,
          skipCount: 0,
          maxResultCount: 10,
          rocordNotPlan: 1

        },
        result: [{}],
      }
    },
    components: {
      ztree, Popup, VueBetterScroll
    },
    directives: {
      TransferDom
    },
    created() {
      this.getAssessmentPlan()
    },
    mounted() {

    },
    methods: {
      search() {
        this.resultlist = [];
        this.getAssessmentPlan();
      },
      onPullingUp() {

        let limitcount = this.resultlist.length;
        this.params.skipCount = limitcount;
        this.getAssessmentPlan();
      },
      goBack() {
        this.$router.go(-1)
      },

      getAssessmentPlan() {
        this.$axiosAjax.checkNotice(this.params).then((res) => {
          if (res.data.success == true) {
            let relist = res.data.result.items;
            this.resultlist = this.resultlist.concat(relist);
            let totalAllCount = res.data.result.totalCount;
            let resultCount = this.resultlist.length;
            if (parseInt(resultCount) < parseInt(totalAllCount)) {
              this.$refs['scrollqq'].forceUpdate(true);
            } else {
              this.$refs['scrollqq'].forceUpdate(false);
            }
          }
        }).catch(
          (err) => {

          }
        )
      },
    },

  }

</script>
<style lang="less" scoped>
  .search-btn {
    width: 200px;
    line-height: 40px;
    border-radius: 20px;
    margin: 23px auto;
    color: #fff;
    background: #469b7a;
    text-align: center;

  }

  .form-item {
    .input_div {
      .vux-x-icon {
        fill: #999;
        float: right;
        margin-top: 18px;
      }
    }
  }

  .project_div {
    .project_list {
      padding-left: 20px;
      li {
        border-bottom: 1px solid #efeff4;
        height: 105px;
        position: relative;
        padding-top: 18px;
        padding-right: 20px;
        h4 {
          width: calc(100% - 40px);
          text-overflow: ellipsis;
          white-space: nowrap;
          overflow: hidden;
          font-size: 16px;
          margin-bottom: 8px;
        }
        div{
          p {
            span {
              font-size: 14px;
              color: #666;
            }
          }
          float: left;
          width: 80%;
        }
        > i {
          display: block;
          height: 15px;
          width: 15px;
          float: right;
          font-size: 12px;
          color: #fff;
          border-radius: 50%;
          background: #469b7a;
          line-height: 17px;
          text-align: center;
          text-indent: 0;
          margin-right: 20px;
        }
        .project_status {
          margin-top: 14px;
          strong {
            font-size: 12px;
          }
          strong.project_status1 {
            color: #ff7333;
          }
          strong.project_status2 {
            color: #469b7a;
          }
        }
        .vux-x-icon {
          fill: #999;
          right: 20px;
          top: 50%;
          margin-top: -11px;
          position: absolute;
        }
      }
    }
  }

  .add_btn {
    position: fixed;
    background: url('../../assets/imgs/add_pro_icon.png') no-repeat;
    background-size: 62px;
    height: 62px;
    width: 62px;
    right: 30px;
    bottom: 35px;
    z-index: 1;
  }

  .addPlan_select {
    position: fixed;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .5);
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
    .planSel_list {
      width: 60%;
      margin: 0 auto;
      padding-top: 150px;
      li {
        border-radius: 10px;
        height: 57px;
        line-height: 57px;
        text-align: center;
        background: #fff;
        margin-bottom: 6px;
        color: #469b7a;
        font-size: 16px;
      }
    }
  }
</style>
